//package com.weimengchao.security.config;
//
//import org.apache.ibatis.type.BaseTypeHandler;
//import org.apache.ibatis.type.JdbcType;
//import org.apache.ibatis.type.MappedJdbcTypes;
//import org.apache.ibatis.type.MappedTypes;
//import org.springframework.stereotype.Component;
//
//import java.sql.CallableStatement;
//import java.sql.PreparedStatement;
//import java.sql.ResultSet;
//import java.sql.SQLException;
//import java.time.LocalDate;
//
///**
// * @description:重写 LocalDateTypeHandler
// * 用于解决查询 LocalDateTypeHandler 字段时报如下异常:
// * Caused by: java.sql.SQLFeatureNotSupportedException: getObject with type
// * at org.apache.shardingsphere.shardingjdbc.jdbc.unsupported.AbstractUnsupportedOperationResultSet.getObject(AbstractUnsupportedOperationResultSet.java:221)
// * at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
// * at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
// * at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
// * at java.lang.reflect.Method.invoke(Method.java:498)
// * at org.apache.ibatis.logging.jdbc.ResultSetLogger.invoke(ResultSetLogger.java:69)
// * at com.sun.proxy.$Proxy108.getObject(Unknown Source)
// * at org.apache.ibatis.type.LocalDateTypeHandler.getNullableResult(LocalDateTypeHandler.java:38)
// * at org.apache.ibatis.type.LocalDateTypeHandler.getNullableResult(LocalDateTypeHandler.java:28)
// * at org.apache.ibatis.type.BaseTypeHandler.getResult(BaseTypeHandler.java:85)
// * @author: 魏孟超
// * @createDate: 2021-09-15 0:57
// */
//@Component
//@MappedTypes(LocalDate.class)
//@MappedJdbcTypes(value = JdbcType.DATE, includeNullJdbcType = true)
//public class LocalDateTypeHandler extends BaseTypeHandler<LocalDate> {
//
//    @Override
//    public void setNonNullParameter(PreparedStatement ps, int i, LocalDate parameter, JdbcType jdbcType)
//            throws SQLException {
//        ps.setObject(i, parameter);
//    }
//
//    @Override
//    public LocalDate getNullableResult(ResultSet rs, String columnName) throws SQLException {
//        Object object = rs.getObject(columnName);
//        return LocalDateConvert.convert(object);
//    }
//
//    @Override
//    public LocalDate getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
//        Object object = rs.getObject(columnIndex);
//        return LocalDateConvert.convert(object);
//    }
//
//    @Override
//    public LocalDate getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
//        Object object = cs.getObject(columnIndex);
//        return LocalDateConvert.convert(object);
//    }
//
//}
//
